package com.hitqz.robot.biz.controller;

import com.hitqz.robot.api.business.model.vo.user.SysUserVo;
import com.hitqz.robot.api.business.model.vo.user.UserInfoVo;
import com.hitqz.robot.common.core.util.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author xupkun
 * @date 2024/5/21
 */
@RestController
@AllArgsConstructor
@RequestMapping("/user")
@Tag(name = "用户信息管理")
public class UserController {

    /**
    * 固定返回给前端，后续在看是否需要验证
    * */
    @GetMapping(value = { "/info" })
    @Operation(summary = "获取当前登陆用户信息")
    public R<UserInfoVo> info() {
        UserInfoVo userInfoVo = new UserInfoVo();
        SysUserVo sysUserVo = new SysUserVo();
        sysUserVo.setUserId(1L);
        sysUserVo.setUsername("admin");
        sysUserVo.setNickname("管理员");
        sysUserVo.setName("管理员");
        userInfoVo.setSysUser(sysUserVo);
        userInfoVo.setRoles(new Long[] {
                1L
        });
        userInfoVo.setPermissions(new String[] {
                "sys_role_export",
                "sys_dept_del",
                "job_sys_job_add",
                "job_sys_job_export",
                "sys_user_edit",
                "sys_file_del",
                "sys_menu_del",
                "sys_role_edit",
                "codegen_template_edit",
                "sys_token_del",
                "sys_dept_add",
                "sys_role_del",
                "sys_syspublicparam_del",
                "job_sys_job_refresh_job",
                "sys_syspublicparam_edit",
                "sys_dict_del",
                "sys_syspublicparam_add",
                "sys_user_del",
                "sys_menu_add",
                "codegen_template_add",
                "sys_client_add",
                "sys_dept_edit",
                "sys_menu_edit",
                "sys_post_export",
                "codegen_template_export",
                "sys_user_add",
                "sys_user_export",
                "job_sys_job_del",
                "warning_view",
                "sys_log_del",
                "codegen_template_del",
                "sys_client_del",
                "sys_client_edit",
                "codegen_group_export",
                "job_sys_job_run_job",
                "job_sys_job_start_job",
                "sys_post_view",
                "sys_dict_edit",
                "job_sys_job_edit",
                "codegen_group_view",
                "sys_log_export",
                "codegen_group_del",
                "sys_post_add",
                "job_sys_job_shutdown_job",
                "warning_export",
                "sys_dict_add",
                "codegen_template_view",
                "sys_role_add",
                "codegen_group_edit",
                "sys_post_del",
                "sys_role_perm",
                "sys_post_edit",
                "codegen_group_add"
        });
        return R.ok(userInfoVo);
    }

}
